<template>
    <div class="workrisk">
        <div class="header">
            <div :class='["itemlist", active==1?"active":""]'
                 @click="activeclick(1)">列表</div>
            <div :class='["itemlist", active==2?"active":""]'
                 @click="activeclick(2)">统计</div>
        </div>
        <!--<div class="left-top-header"  v-show="active==1">
            <div class="searchDiv">
              <div @click="showcompany">违章单位</div>
              <div @click="newflagtwo=true">违章类型</div>
              <datetime  format="YYYY-MM-DD HH:mm" title='开始时间'></datetime>
              <datetime  format="YYYY-MM-DD HH:mm" title='结束时间'></datetime>
            </div>

      </div>-->
        <div class="content"
             v-show="active==1">
            <div class="toleft">
                <div class="itemname"
                     @click="lookCompany">
                    <div class="showl">单位名称</div>
                    <div class="showr">{{showsearch.companyName}}</div>
                    <i class="iconfont icon-jinru rightmsg"></i>
                </div>
                <div class="itemname"
                     @click="newflagtwo = true">
                    <div class="showl">查询类型</div>
                    <div class="showr">{{showsearch.typeName}}</div>
                    <i class="iconfont icon-jinru rightmsg"></i>
                </div>
                <div class="itemname">
                    <div class="showl">开始时间</div>
                    <datetime v-model="showsearch.startDate"
                              @on-change="changestart"
                              clear-text="today">
                        <div class="showlisttime">
                            {{showsearch.startDate}}
                            <i class="iconfont icon-jinru rightmsg"></i>
                        </div>
                    </datetime>
                </div>
                <div class="itemname">
                    <div class="showl">结束时间</div>
                    <datetime :start-date="startDateOn"
                              v-model="showsearch.endDate"
                              @on-change="changeend"
                              clear-text="today">
                        <div class="showlisttime">
                            {{showsearch.endDate}}
                            <i class="iconfont icon-jinru rightmsg"></i>
                        </div>
                    </datetime>
                </div>
                <!-- <div class="looksearch" v-show="role==1&&(jlpeople||rolepeople||elepeople)" > -->
                <!--<div class="c-look" @click="newlistsearchfew">查询</div>-->
                <!-- <div>新增</div>
                   <x-icon style="fill:#2269ff" type="ios-plus"  @click="showlistpage" class="newlist" size="50" @icon-success-color="'#ff0'"></x-icon>
              </div> -->
            </div>
            <div class="colorlist"></div>
            <div class="showleft">

                <!--<vue-better-scroll class="wrapper"
                                       ref="scrollqq"
                                       :scrollbar="scrollbarObj"
                                       :pullDownRefresh="pullDownRefreshObj"
                                       :pullUpLoad="pullUpLoadObj"
                                       :startY="parseInt(startY)"
                                       @pullingUp="onPullingUp"
                                       >-->
                <noData v-if="dataList.length == 0"></noData>
                <div class="list-bottom"
                     v-for="(item,index) in dataList"
                     :key="index"
                     @click="selectchange(item)">
                    <div class="lefttrue">
                        <div class="workselect">{{item.title}}</div>
                        <div class="workdate">{{item.date|filterdata}}</div>
                    </div>
                    <div class="righrtrue">
                        <div class="w-c-c">
                            <span :class="'toSqweqq'+item.mStatus">【{{item.mStatus |changemStatuslist}}】
                            </span>
                            <span :class="'toSqwe'+item.stateType"> 【{{item.stateType|changeTypelist}}】</span>
                        </div>
                        <div class="w-c-i">
                            <img src="../../../static/images/5.png">
                        </div>
                    </div>
                </div>
                <!-- </vue-better-scroll>-->
            </div>
        </div>
        <div class="content1"
             v-show="active==2">

            <div class="toleft">
                <div class="itemname"
                     @click="lookCompany">
                    <div class="showl">单位名称</div>
                    <div class="showr">{{showsearch.companyName}}</div>
                    <i class="iconfont icon-jinru rightmsg"></i>
                </div>
                <div class="itemname"
                     @click="newflagtwo = true">
                    <div class="showl">查询类型</div>
                    <div class="showr">{{showsearch.typeName}}</div>
                    <i class="iconfont icon-jinru rightmsg"></i>
                </div>
                <div class="itemname">
                    <div class="showl">开始时间</div>
                    <datetime v-model="showsearch.startDate"
                              @on-change="changestart"
                              clear-text="today">
                        <div class="showlisttime">
                            {{showsearch.startDate}}
                            <i class="iconfont icon-jinru rightmsg"></i>
                        </div>
                    </datetime>
                </div>
                <div class="itemname">
                    <div class="showl">结束时间</div>
                    <datetime :start-date="startDateOn"
                              v-model="showsearch.endDate"
                              @on-change="changeend"
                              clear-text="today">
                        <div class="showlisttime">
                            {{showsearch.endDate}}
                            <i class="iconfont icon-jinru rightmsg"></i>
                        </div>
                    </datetime>
                </div>

            </div>
            <div class="tomoddle">
                总计:已通过{{AVCcount}}次，已监控{{BSVcount}}次，进行中{{CSVcount}}次
            </div>
            <noData v-if="dataListcount.length == 0"></noData>
            <div class="tobottom"
                 v-for="(item,index) in dataListcount"
                 :key="index">
                <div class="newtop">
                    {{item.DepartName}}
                </div>
                <div class="numberlist">
                    <div class="n-1">
                        <div class="top-n">{{item.ASVCount}}</div>
                        <div class="bottom-n">已通过</div>
                    </div>
                    <div class="n-1">
                        <div class="top-n">{{item.BSVCount}}</div>
                        <div class="bottom-n">已监控</div>
                    </div>
                    <div class="n-1">
                        <div class="top-n">{{item.CSVCount}}</div>
                        <div class="bottom-n">进行中</div>
                    </div>
                </div>
            </div>

        </div>
        <div class="masklist"
             v-if="showflag">
        </div>
        <!-- <div class="newlistp" v-show="active==1&&role==1">
          <div class="imglist">
            <x-icon style="fill:#2269ff" type="ios-plus"  @click="showlistpage" class="newlist" size="50" @icon-success-color="'#ff0'"></x-icon>
          </div>
      </div>-->
        <div v-transfer-dom>
            <popup v-model="newflag"
                   width="100%">
                <div class="position-horizontal-demo"
                     v-if="roleStatus2"
                     @click="gotohotwork">
                    <span class="vux-close">
                        动火作业（一级）申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus1"
                     @click="gotoweightwork">
                    <span class="vux-close">
                        起重吊装作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotohotwork2">
                    <span class="vux-close">
                        动火作业（二三级）申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotohighformwork">
                    <span class="vux-close">
                        高支模拆除作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotosafework">
                    <span class="vux-close">
                        安全防护设施拆除作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotoconstrudwork">
                    <span class="vux-close">
                        施工现场危险作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotocrosswork">
                    <span class="vux-close">
                        交叉作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotoboundedwork">
                    <span class="vux-close">
                        受限空间作业申请
                    </span>
                </div>
                <div class="position-horizontal-demo"
                     v-if="roleStatus3"
                     @click="gotoelectordwork">
                    <span class="vux-close">
                        临近带电体安全施工作业申请
                    </span>
                </div>
            </popup>
        </div>

        <div v-transfer-dom>
            <popup v-model="newflagtwo"
                   width="100%">
                <!-- <div class="newlistdemo" @click="toclose">
            确认
          </div>-->
                <div class="position-horizontal-demo"
                     @click="changeType(999)">
                    <span class="vux-close">
                        全部
                    </span>
                    <x-icon type="ios-checkmark-empty"
                            v-if="allcheck"
                            size="30"></x-icon>
                </div>
                <div v-for="(item,index) in typeList"
                     class="position-horizontal-demo"
                     @click="changeType(index)"
                     :key="index">
                    <span class="vux-close">
                        {{item}}
                    </span>
                    <x-icon type="ios-checkmark-empty"
                            size="30"
                            v-if="checklist[0]"></x-icon>
                </div>

            </popup>
        </div>
        <myMenu :addPath="addPath"
                @showRiskList="showRiskList"></myMenu>
        <companyProp :companyPropShow="companyPropShow"
                     :selectCompany="selectCompany"
                     business="GetHdProjectsAndFb"
                     :selectSlef="false"></companyProp>

    </div>
</template>

<script>

import { Selector, PopupRadio, Datetime, TransferDom, Popup } from 'vux'
import myMenu from '@/commonComponents/menu'
import VueBetterScroll from 'vue2-better-scroll'
import companyProp from '@/commonComponents/companyProp'
const getDate = () => {
    var date = new Date()
    var seperator1 = '-'
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var strDate = date.getDate()
    if (month >= 1 && month <= 9) {
        month = '0' + month
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = '0' + strDate
    }
    var currentdate = year + seperator1 + '01' + seperator1 + '01'
    return currentdate
}
const endDate = () => {
    var date = new Date()
    var seperator1 = '-'
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var strDate = date.getDate()
    if (month >= 1 && month <= 9) {
        month = '0' + month
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = '0' + strDate
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate
    return currentdate
}
export default {
    name: 'App',
    directives: {
        TransferDom
    },
    data () {
        return {
            roleArr: [], // 用户身份集合
            roleStatus1: false, // 是否是项目设备管理员
            roleStatus2: false, // 是否是项目经理
            roleStatus3: false, // 是否是项目施工员
            active: 1,
            showflag: false,
            scrollbarObj: {
                fade: true
            },
            // 这个配置用于做下拉刷新功能，默认为 false。当设置为 true 或者是一个 Object 的时候，可以开启下拉刷新，可以配置顶部下拉的距离（threshold） 来决定刷新时机以及回弹停留的距离（stop）
            pullDownRefreshObj: false,
            // 这个配置用于做上拉加载功能，默认为 false。当设置为 true 或者是一个 Object 的时候，可以开启上拉加载，可以配置离底部距离阈值（threshold）来决定开始加载的时机
            pullUpLoadObj: {
                threshold: 0,
                txt: {
                    more: '加载更多',
                    noMore: '没有更多数据了'
                }
            },
            startY: 0, // 纵轴方向初始化位置
            newflag: false,
            newflagtwo: false,
            newflagthree: false,
            newflagfour: false,
            addFlag: false, //
            addPath: false, // munu是否显示新增+
            checklist: [],
            allcheck: true,
            userId: '',
            tokenId: '',
            projectId: '',
            userInfo: '',

            startDateOn: getDate(), // 开始时间
            EndDate: '', // 结束时间

            showsearch: {
                companyName: '',
                type: 0,
                typeName: '全部',
                startDate: getDate(),
                endDate: endDate()
            },

            typeList: ['动火作业',
                '安全防护设施拆除', '施工现场危险作业', '高支模拆作业', '起重吊装作业',
                '交叉作业', '受限空间作业',
                '临近带点体安全施工作业'
            ],

            role: '',
            dataList: [],
            dataListcount: [],

            AVCcount: 0,
            BSVcount: 0,
            CSVcount: 0, //

            rolepeople: false, // rolepeople==1//项目施工员
            elepeople: false, // 设备施工员
            safepeople: false, // 项目安全员
            safeallpeople: false, // 项目安全总监
            jlpeople: false, //
            companyPropShow: false // 选择单位弹框
        }
    },
    components: {
        Popup,
        PopupRadio,
        Selector,
        Datetime,
        VueBetterScroll,
        myMenu,
        companyProp
    },
    computed: {
    },
    watch: {
    },
    created () {
        this.userInfo = JSON.parse(localStorage.userInfo)
        this.userId = this.userInfo.userid
        this.tokenId = this.userInfo.tokenId
        this.projectId = this.userInfo.deptid

        // this.addPath = this.userInfo.departsir == '1' || false

        this.showsearch = Object.assign({}, this.showsearch, this.$store.state.showsearch)
        if (!this.showsearch.companyName) {
            this.showsearch.companyName = this.userInfo.deptname
            this.showsearch.deptId = this.userInfo.deptid
        }
        this.role = this.userInfo.departsir

        this.rolecheck2()

        // this.rolepeople = this.rolecheck(1) // 项目施工员
        // this.elepeople = this.rolecheck(2)// 设备管理员
        // this.safepeople = this.rolecheck(3)// 项目安全员
        // this.safeallpeople = this.rolecheck(4)// 安全总监
        // this.jlpeople = this.rolecheck(5)// 项目经理

        this.getDate()
        this.getDatenew()
    },
    methods: {
        showRiskList () {
            this.newflag = true
        },
        activeclick (index) {
            this.active = index
        },
        showmsg () {
            this.showflag = !this.showflag
        },
        showlistpage () {
            // let z = this.
            // if(this.elepeople){
            //    this.gotoweightwork();
            // }else{if(this.elepeople){
            //    this.gotoweightwork();
            // }else{
            this.newflag = true
            // }
        },
        onPullingDown () {
            console.log('xl')
        },
        onPullingUp () {
            console.log('sl')
            // this.pageNum++
            // this.showlistmsg()
            this.$refs[`scrollqq`].forceUpdate(true)
        },
        changeType (index) {
            if (index == '999') {
                this.checklist = []
                this.allcheck = true
                this.$store.state.showsearch = Object.assign({}, this.$store.state.showsearch, {
                    'typeName': '全部',
                    'type': 0
                })
                this.showsearch = Object.assign({}, this.showsearch, {
                    'typeName': '全部',
                    'type': 0
                })
            } else {
                // this.checklist[index] = !this.checklist[index];
                this.allcheck = false
                //  let typeNamelist=[];
                //   let typeLists =[];
                //   this.checklist.forEach(
                //     (item,index)=>{
                //         if(item){
                //             typeNamelist.push(this.typeList[index]);
                //              typeLists.push(index);
                //         }
                //     }
                //   )

                this.$store.state.showsearch = Object.assign({}, this.$store.state.showsearch, {
                    'typeName': this.typeList[index],
                    'type': Number(index + 1)
                })
                this.showsearch = Object.assign({}, this.showsearch, {
                    'typeName': this.typeList[index],
                    'type': Number(index + 1)
                })
            }
            this.newflagtwo = false
            this.getDate()
            this.getDatenew()
            console.log(this.$store.state.showsearch)
            this.$forceUpdate()
        },
        toclose () {
            this.newflagtwo = false
        },
        showaction () {
            this.newflagthree = true
        },
        companysearch () {
            this.newflagfour = true
        },
        getDate () { // 获取列表数据
            this.$vux.loading.show({
                text: '加载中...'
            })

            // mapper.set("param",{
            //           "deptId": this.showsearch.deptId,
            //           "startDate": this.showsearch.startDate,
            //           "EndDate": this.showsearch.endDate,
            //           "needProcess":false,
            //           "type":this.showsearch.type,
            //   });
            let param = {
                'allowPaging': true,
                'business': 'GetDangerJobs',
                'data': {
                    'deptId': this.showsearch.deptId,
                    'startDate': this.showsearch.startDate,
                    'EndDate': this.showsearch.endDate,
                    'needProcess': false,
                    'type': this.showsearch.type
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }

            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.$vux.loading.hide()
                    this.dataList = res.data.data

                    // this.theModel = res.data.data
                }
            )
        },
        getDatenew () {
            let param = {
                'allowPaging': true,
                'business': 'GetDangerJobCount',
                'data': {
                    'ProjectID': this.showsearch.deptId,
                    'startDate': this.showsearch.startDate,
                    'EndDate': this.showsearch.endDate,
                    'DangerType': this.showsearch.typeName
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$vux.loading.show({
                text: '加载中...'
            })
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.$vux.loading.hide()
                    this.dataListcount = res.data.data
                    // this.theModel = res.data.data
                    this.AVCcount = 0
                    this.BSVcount = 0
                    this.CSVcount = 0
                    this.dataListcount.forEach(
                        (item) => {
                            this.AVCcount = this.AVCcount + item.ASVCount
                            this.BSVcount = this.BSVcount + item.BSVCount
                            this.CSVcount = this.CSVcount + item.CSVCount
                        }
                    )

                    console.log(this.AVCcount)
                }
            )
        },
        lookCompany () {
            // this.$router.push('/showcompany')
            this.companyPropShow = true
        },
        changestart (val) {
            this.$store.state.showsearch = Object.assign({}, this.$store.state.showsearch, {
                'startDate': val,
                'endDate': val
            })
            let x = new Date(val).getTime() - new Date(this.showsearch.endDate).getTime()
            if (x > 0) {
                this.showsearch.endDate = val
            } else {
                this.getDate()
                this.getDatenew()
            }
            this.startDateOn = val
            this.$forceUpdate()
        },
        changeend (val) {
            this.$store.state.showsearch = Object.assign({}, this.$store.state.showsearch, {
                'endDate': val
            })
            this.showsearch.endDate = val
            this.getDate()
            this.getDatenew()
            this.$forceUpdate()
        },
        newlistsearch () {
            this.getDate()
        },
        // newlistsearchfew(){
        //   this.getDatenew();
        // },
        // 跳转动火作业（一级）申请
        gotohotwork () {
            this.$router.push('/hotwork')
        },
        // 动火作业（二、三级）申请
        gotohotwork2 () {
            this.$router.push('/hotworkrep')
        },
        // 高支模块拆除作业申请
        gotohighformwork () {
            this.$router.push('/highformwork')
        },
        // 交叉作业作业申请
        gotocrosswork () {
            this.$router.push('/crosswork')
        },
        gotoweightwork () {
            this.$router.push('/weightwork')
        },
        gotosafework () {
            this.$router.push('/safework')
        },
        gotoboundedwork () {
            this.$router.push('/boundedwork')
        },
        gotoconstrudwork () {
            this.$router.push('/construwork')
        },
        gotoelectordwork () {
            this.$router.push('/electorwork')
        },
        selectchange (item) {
            if (item.type == 2) {
                if (item.stateType == 4) {
                    this.$router.push('/safework?id=' + item.id)
                }
                if (item.stateType == 2) {
                    //  if(this.safeallpeople){
                    this.$router.push('/safelook?id=' + item.id)
                    //  }
                }
                if (item.stateType == 3) {
                    this.$router.push('/safecontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }

            // 动火作业（一级、二三级）
            if (item.type == 1) {
                if (item.stateType == 2) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotworkApprove?id=' + item.id)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrepApprove?id=' + item.id)
                    }
                }
                if (item.stateType == 3) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrepMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                    }
                }
                if (item.stateType == 4) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotwork?id=' + item.id)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrep?id=' + item.id)
                    }
                }
            }

            if (item.type == 3) {
                if (item.stateType == 4) {
                    this.$router.push('/construwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/construlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/construcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            // 高支模板拆除作业
            if (item.type == 4) {
                if (item.stateType == 2) {
                    this.$router.push('/formworkApprove?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/formworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                }
                if (item.stateType == 4) {
                    this.$router.push('/highformwork?id=' + item.id)
                }
            }
            if (item.type == 5) {
                if (item.stateType == 4) {
                    this.$router.push('/weightwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    this.$router.push('/weightlook?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/weightcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            // 交叉作业
            if (item.type == 6) {
                if (item.stateType == 4) {
                    this.$router.push('/crosswork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    this.$router.push('/crossworkApprove?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/crossworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            if (item.type == 7) {
                if (item.stateType == 4) {
                    this.$router.push('/boundedwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/boundedlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/boundedcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            if (item.type == 8) {
                if (item.stateType == 4) {
                    this.$router.push('/electorwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/electorlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/electorcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
        },
        rolecheck2 () {
            var that = this
            let param = {
                'allowPaging': true,
                'business': 'GetAddWorkRole',
                'data': {
                    'roleName': this.userInfo.usermode
                }
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    // console.log(res)
                    var that = this
                    this.roleArr = res.data.code.split(',')
                    // console.log(this.roleArr)
                    if (that.roleArr.indexOf('1') > -1) {
                        that.roleStatus1 = true
                    }
                    if (that.roleArr.indexOf('2') > -1) {
                        that.roleStatus2 = true
                    }
                    if (that.roleArr.indexOf('3') > -1) {
                        that.roleStatus3 = true
                    }
                    if (this.roleStatus1 || this.roleStatus2 || this.roleStatus3) {
                        this.addPath = true
                    } else {
                        this.addPath = false
                    }
                }
            ).catch(() => {
            })
        },
        rolecheck (index) {
            // index==1  验证是否是项目施工员  index==2  验证是否是设备管理员
            let arr = []
            let flag = false
            arr = this.userInfo.usermode.split(',')
            if (index == 1) {
                arr.forEach(
                    (item, index) => {
                        if (item == '项目施工员') {
                            flag = true
                        }
                    }
                )
            }
            if (index == 2) {
                arr.forEach(
                    (item, index) => {
                        if (item == '项目设备管理员') {
                            flag = true
                        }
                    }
                )
            }
            if (index == 3) {
                arr.forEach(
                    (item, index) => {
                        if (item == '项目安全员') {
                            flag = true
                        }
                    }
                )
            }
            if (index == 4) {
                arr.forEach(
                    (item, index) => {
                        if (item == '项目安全总监') {
                            flag = true
                        }
                    }
                )
            }
            if (index == 5) {
                arr.forEach(
                    (item, index) => {
                        if (item == '项目经理') {
                            flag = true
                        }
                    }
                )
            }
            if (index == 6) {
                arr.forEach(
                    (item, index) => {
                        if (item == '分公司安全总监') {
                            flag = true
                        }
                    }
                )
            }
            return flag
        },
        selectCompany (item) {
            this.companyPropShow = false
            this.showsearch.companyName = item.Name
            this.showsearch.deptId = item.Id
            this.getDate()
            this.getDatenew()
        }
    },
    filters: {
        changeTypelist (val) {
            if (!val) {
                return false
            }
            if (val == 1) {
                return '未提交'
            } else if (val == 2) {
                return '待审批'
            } else if (val == 3) {
                return '已通过'
            } else if (val == 4) {
                return '未通过'
            }
        },
        changemStatuslist (val) {
            if (!val) {
                return false
            }
            if (val == 1) {
                return '待监控'
            } else if (val == 2) {
                return '已监控'
            }
        },
        filterdata (val) {
            if (!val) {
                return false
            }
            return val.substring(0, 10)
        }
    }
}
</script>

<style scoped lang="less">
.icon-jinru {
    color: #c8c8cd;
}
.workrisk {
    display: flex;
    display: -webkit-flex;
    /* vh 相对于可视区域的高度 */
    height: 100vh;
    /* 设置主轴方向 */
    flex-direction: column;
    overflow: hidden;
    background-color: #ebeef3;
}
.header {
    height: 62px;
    display: flex;
    width: 100%;
    justify-content: space-around;
    padding-top: 5px;
    background-color: #fff;
}
.itemlist {
    width: 60px;
    height: 100%;
    line-height: 62px;
    text-align: center;
    position: relative;
}
.itemlist.active {
    color: #2269ff;
}
.itemlist.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2269ff;
    height: 5px;
}
.content {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    width: 100%;
    overflow: scroll;
    background-color: #ffffff;
    margin-top: 4px;
}
.content1 {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    width: 100%;
    overflow: scroll;
    background-color: #ebeef3;
    margin-top: 4px;
}
.showleft {
    width: 100%;
    // height:100%;
    position: relative;
    padding-left: 20px;
    // padding-top:44px;
}
.left-top-header {
    height: 40px;
    line-height: 40px;
    width: 100%;
    // position:absolute;
    // top:0;
    // left:0;
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.searchDiv {
    width: 100%;
    background-color: #fff;
    display: flex;
    line-height: 40px;
    padding-right: 15px;
    justify-content: space-around;
    border-bottom: 1px solid #ebeef3;
    border-top: 5px solid #ebeef3;
    align-items: center;
    overflow: hidden;
    > div {
        font-size: 12px;
        color: #333333;
        background: url(../../../static/images/4.png) no-repeat right 0 center;
        background-size: 6px 5px;
    }
    > a {
        font-size: 12px;
        color: #333333;
        background: url(../../../static/images/4.png) no-repeat right 0 center;
        background-size: 6px 5px;
    }
}

.list-bottom {
    // padding-top:4px;
    height: 82px;
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 20px 20px 20px 0;
    border-bottom: 1px solid #ccc;
}
.workselect {
    height: 18px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 18px;
    font-size: 14px;
    color: #333;
}
.workdate {
    height: 14px;
    line-height: 14px;
    font-size: 14px;
    color: #999;
    margin-top: 16px;
}
.righrtrue {
    display: flex;
}
.w-c-c {
    padding-top: 13px;
    color: #fe7234;
    margin-right: 10px;
    font-size: 13px;
}
.w-c-i {
    padding-top: 13px;
}
.toleft {
    background-color: #fff;
    padding-left: 20px;
}
.itemname {
    padding: 0 20px 0 0;
    height: 58px;
    line-height: 58px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ebeef3;
    align-items: center;
}
.showl {
    height: 100%;
    line-height: 58px;
    font-size: 14px;
    color: #333;
}
.showr {
    position: relative;
    left: 27px;
    height: 100%;
    line-height: 58px;
    font-size: 14px;
    color: #999;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 200px;
    text-align: right;
}
.looksearch {
    height: 90px;
    padding: 26px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 20px;
}
.c-look {
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: #fff;
    border-radius: 20px;
    background-color: #2269ff;
    width: 100px;
    margin: 0 auto;
}
.tomoddle {
    background-color: #ebeef3;
    height: 40px;
    line-height: 40px;
    font-size: 12px;
    text-align: right;
    padding-right: 20px;
}
.tobottom {
    background-color: #fff;
    height: 115px;
    padding-top: 15px;
}
.newtop {
    font-size: 14px;
    height: 14px;
    line-height: 14px;
    padding-left: 20px;
    color: #2169fc;
}
.numberlist {
    display: flex;
    margin-top: 25px;
}
.n-1 {
    flex: 1;
}
.top-n {
    height: 20px;
    line-height: 20px;
    width: 100%;
    text-align: center;
    color: #2369ff;
    font-size: 20px;
    border-right: 1px solid #ccc;
}
.bottom-n {
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 14px;
    color: #999;
    margin-top: 15px;
}
.newlistp {
    bottom: 75px;
    width: 50px;
    height: 50px;
    color: #fff;
    position: fixed;
    // transition: all 1s ease;
    right: 30px;
    filter: url(#goo);
    z-index: 8 !important;
}
.imglist {
    height: 50px;
    width: 50px;
}
.imglist > img {
    height: 50px;
    width: 50px;
}
.masklist {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 6 !important;
}
.classContent {
    position: absolute;
    bottom: 50px;
    left: -210px;
    background-color: #fff;
    width: 200px;
    border-radius: 4px;
}
.clist {
    height: 40px;
    line-height: 40px;
    padding: 0 20px;
    text-align: center;
    font-size: 12px;
}
.position-horizontal-demo {
    height: 55px;
    line-height: 55px;
    padding-left: 20px;
    font-size: 16px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 20px;
    background-color: #fff;
    border-bottom: 1px solid #ebeef3;
}
.newlistdemo {
    text-align: right;
    height: 40px;
    line-height: 40px;
    padding-left: 20px;
    font-size: 13px;
    color: #666;
    background-color: #fff;
    padding-right: 20px;
}
.showlisttime {
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    color: #999;
}
.colorlist {
    width: 100%;
    height: 8px;
    background-color: #ebeef3;
}
.toSqwe1 {
    font-size: 14px;
}
.toSqwe2 {
    color: #333;
    font-size: 14px;
}
.toSqwe3 {
    color: green;
    font-size: 14px;
}
.toSqwe4 {
    color: red;
    font-size: 14px;
}
.toSqweqq1 {
    color: #333;
    font-size: 14px;
}
.toSqweqq2 {
    color: green;
    font-size: 14px;
}
</style>
<style>
.workrisk .weui-cell {
    padding-right: 0;
}
.workrisk .weui-cell:before {
    border-top: none;
}
</style>
